from aiogram_dialog import Dialog, Window
from aiogram_dialog.widgets.input import TextInput
from aiogram_dialog.widgets.kbd import Cancel

from src.bot.dialogs.extras import copy_start_data_to_ctx
from src.bot.dialogs.widgets import LocaleText
from src.bot.states.user import ChangeUserTimeSG

from .handlers import proccess_new_time

enter_new_time_window = Window(
    LocaleText("enter-new-time-msg"),
    TextInput("new_time", str, on_success=proccess_new_time),
    Cancel(LocaleText("back-btn")),
    state=ChangeUserTimeSG.enter_new_time,
)


enter_new_time_dialog = Dialog(enter_new_time_window, on_start=copy_start_data_to_ctx)
